package com.hivekion.common.entity;

import lombok.Data;

import java.io.Serializable;
import java.util.List;

@Data
public class PagedResultVo<T> implements Serializable {

      private Integer pageSize;
      private Integer pageNum;
      private Integer totalPage; // 总页数
      private Integer totalCount; // 总条数
      private List<T> data;

      public PagedResultVo() {
      }

      public PagedResultVo(SearchInputVo inputVo, Integer TotalCount, List<T> Data) {
	    this.pageNum = inputVo.getPageNum();
	    this.pageSize = inputVo.getPageSize();
	    this.totalCount = TotalCount;
	    if (inputVo.getPageSize() > 0){
            this.totalPage = (int)Math.ceil((double)TotalCount / (double)inputVo.getPageSize());
        }else {
            this.totalPage = 0;
        }
	    this.data = Data;
      }
}
